<template>
  <div>
    <!-- 头部 -->
    <div>
      <van-nav-bar>
        <template #left>
          <h1 @click="$router.back()">
            <van-icon name="arrow-left" />
          </h1>
        </template>
        <template #title>
          <div class="qb">
            <p>司机认证</p>
          </div>
        </template>
        <template #right></template>
      </van-nav-bar>
    </div>
    <!-- 内容 -->
    <div class="box">
      <!-- 半身照片照片 -->
      <div class="ban">
        <div class="ban_left">
          <van-uploader :after-read="afterRead" />
        </div>
        <div class="ban_right">
          <span>半身免冠工作照</span>
          <span>（请使用手机拍摄本人）</span>
        </div>
      </div>
      <!-- 驾驶证照片 -->
      <!-- 反面 -->
      <div class="ban" style="margin-top: 10px">
        <div class="ban_left">
          <van-uploader :after-read="afterRead" />
        </div>
        <div class="ban_right">
          <span>驾驶证正面</span>
          <span>（请使用手机拍摄或上传）</span>
        </div>
      </div>
      <!-- 正面 -->
      <div class="ban" style="margin-top: 10px">
        <div class="ban_left">
          <van-uploader :after-read="afterRead" />
        </div>
        <div class="ban_right">
          <span>驾驶证反面</span>
          <span>（请使用手机拍摄或上传）</span>
        </div>
      </div>
      <!-- 个人信息 -->
      <div class="my">
        <div class="my_1 my1">
          <div class="left">
            <van-icon name="https://b.yzcdn.cn/vant/icon-demo-1126.png" size="35px" />
          </div>
          <div class="right">
            <input v-model="names" type="text" placeholder="真实姓名" />
          </div>
        </div>
        <div class="my_1">
          <div class="left">
            <van-icon name="coupon-o" size="35px" />
          </div>
          <div class="right">
            <input type="text" placeholder="身份证号码" />
          </div>
        </div>
        <div class="my_1">
          <div class="left">
            <van-icon name="phone-o" size="35px" />
          </div>
          <div class="right">
            <input type="text" placeholder="紧急联系人手机号码" />
          </div>
        </div>
      </div>
      <!-- 我已阅读并同意《代驾人认证协议》 -->
      <div class="yue">
        <div>
          <input type="checkbox" name id="语文" />
          <label for="语文"></label>
          <span style="margin-left: 15px; font-family: cursive">
            我已阅读并同意
            <span style="color: orange">《代驾人认证协议》</span>
          </span>
        </div>
      </div>
      <!-- 确认提交按钮 -->
      <div class="btn">
        <button @click="bro">确认提交</button>
      </div>
    </div>
  </div>
</template>

<script>
import { Toast } from "vant";
export default {
  data() {
    return {
      names: ""
    };
  },
  methods: {
    afterRead(file) {
      // 此时可以自行将文件上传至服务器
      console.log(file);
    },
    bro() {
      if (this.names.trim() != "") {
        this.$store.commit("setnames", this.names);
        this.$router.push("/home");
        this.names = "";
      } else {
        Toast.fail("请输入您的信息:)");
      }
    }
  }
};
</script>

<style scoped>
* {
  margin: 0;
  padding: 0;
}
.div_1 {
  color: orange;
  font-size: 14px;
}
.qb {
  letter-spacing: 2px;
  font-size: 20px;
  font-weight: bold;
  text-align: center;
}
.box {
  width: 90%;
  margin: 20px auto 0;
}
.ban {
  width: 100%;
  height: 150px;
  /* background: plum; */
  border: 2px solid #ccc;
  border-radius: 10px;
  box-shadow: pink 0px 0px 10px;
  overflow: hidden;
}
.ban_left {
  float: left;
  width: 80px;
  height: 80px;
  margin-top: 30px;
  margin-left: 20px;
}
.ban_right {
  float: right;
  font-family: cursive;
  font-size: 18px;
  text-align: center;
  font-weight: bold;
  margin-top: 50px;
}
.ban_right span {
  display: block;
}
.my {
  width: 100%;
  height: 200px;
  /* background: plum; */
  border: 2px solid #ccc;
  border-radius: 10px;
  box-shadow: pink 0px 0px 10px;
  overflow: hidden;
  margin-top: 10px;
}
.my_1 {
  overflow: hidden;
  height: 60px;
  line-height: 50px;
}
.left {
  float: left;
  margin: 13px 0 0 15px;
}
.right {
  float: left;
}
.right input {
  height: 30px;
  margin-left: 20px;
  width: 110%;
  outline: none;
  border: none;
  color: plum;
  font-family: cursive;
}
.my1 {
  margin-top: 15px;
}
/* 按钮 */
.yue {
  margin-top: 10px;
  margin-left: 15px;
}
.yue label {
  width: 18px;
  height: 18px;
  border: 1px solid #000;
  display: inline-block;
  vertical-align: top;
}
.yue input {
  display: none;
}
.yue input:checked + label {
  text-align: center;
  line-height: 20px;
  background: black;
  /*这里可以加设计好的对勾图片，以背景的方式加上去  下面的伪类样式就可以不用加了*/
}
.yue input:checked + label::after {
  content: "\2714";
  color: #fff;
}
.btn {
  width: 100%;
  height: 40px;
  background: #000;
  color: #fff;
  border-radius: 10px;
  margin-top: 20px;
}
.btn button {
  width: 100%;
  height: 100%;
  text-align: center;
  line-height: 100%;
  outline: none;
  border: none;
  background: #000;
}
</style>